/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model.estrutura;

import delaunay_triangulation.Triangle_dt;
import java.io.Serializable;
import java.util.ArrayList;

/**
 *
 * @author Thiago
 */
public class Face implements Serializable {

    private ArrayList<Aresta> arestas;
    
    public Face() {
        this.arestas = new ArrayList<>();
    }

    public Face(ArrayList<Aresta> arestas) {
        this.arestas = arestas;
    }
    
    public void addAresta(Aresta a) {
        if (!this.arestas.contains(a)) {
            this.arestas.add(a);
        }
    }
    
    public ArrayList<Aresta> getArestas(){
        return this.arestas;
    }
    
    public ArrayList<Ponto> getPontosDuplicados() {
        ArrayList<Ponto> array = new ArrayList<>();
        for (Aresta a : this.arestas) {
            array.add(a.getInicio());
//            array.add(a.getFim());
        }
        return array;
    }
    
    public ArrayList<Ponto> getPontos() {
        ArrayList<Ponto> array = new ArrayList<>();
        for (Aresta a : this.arestas) {
            if(!array.contains(a.getInicio()))
                array.add(a.getInicio());
            if(!array.contains(a.getFim()))
                array.add(a.getFim());
        }
        return array;
    }
    
    public String toString(){
        ArrayList<Ponto> pon = this.getPontosDuplicados();
        String s = "";
        for (Ponto pon1 : pon) {
            s += pon1.toString() + "\n";
        }
        s+= "\n";
        return s;
    }
}
